<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;



//后台模块表
class BannerModel extends Model
{
    //定义一个表名
    protected $table = 'banner';
    //定义主键
    protected $primaryKey = 'id';
    protected $guarded = [];

    static function doList(){
    	$banner = [];
		$banners = BannerModel::where('state',1)->orderBy('sort','desc')->get();
		foreach($banners as $k=>$v){
			$banner[$k]['id'] = $v['id'];
			$banner[$k]['picname'] = "http://".$_SERVER['HTTP_HOST'].$v['picname'];
			if($v['oss_pic']){
				$banner[$k]['picname'] = $v['oss_pic'];
			}
		}
		return $banner;
	}
}
